package com.lmx.repoDomain.tmodel;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;

/**
 * 员工请假
 *
 * @author ytche
 * @date 2017年7月12日
 *
 */
@Entity
@Table(name = "tnb_employee_leave_flow")
@JsonApiResource(type = "employeeLeaveFlow")
public class EmployeeLeaveFlow extends BaseEntity {
	private static final long serialVersionUID = 1L;
	private Integer expectStartTime; // 预计开始时间
	private Integer expectEndTime; // 预计结束时间
	private String reason;
	private Dicttype type;
	private Integer realEndTime; // 销假时间
	private Employee applicant;
	private Integer applyTime;
	private Integer flowStatus;

	private Employee approver;
	private Integer approveTime;
	private String remark;
	private Integer result;

	private Set<Integer> leaveDay;
	private String leaveDayStr;

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JsonApiIncludeByDefault
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "applicant_id")
	public Employee getApplicant() {
		return applicant;
	}

	public void setApplicant(Employee applicant) {
		this.applicant = applicant;
	}

	@Column(name = "apply_time")
	public Integer getApplyTime() {
		return applyTime;
	}

	public void setApplyTime(Integer applyTime) {
		this.applyTime = applyTime;
	}

	@Column(name = "flow_status")
	public Integer getFlowStatus() {
		return flowStatus;
	}

	public void setFlowStatus(Integer flowStatus) {
		this.flowStatus = flowStatus;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
	@JsonApiIncludeByDefault
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "approver_id")
	public Employee getApprover() {
		return approver;
	}

	public void setApprover(Employee approver) {
		this.approver = approver;
	}

	@Column(name = "approve_time")
	public Integer getApproveTime() {
		return approveTime;
	}

	public void setApproveTime(Integer approveTime) {
		this.approveTime = approveTime;
	}

	@Column(name = "remark")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Column(name = "result")
	public Integer getResult() {
		return result;
	}

	public void setResult(Integer result) {
		this.result = result;
	}

	@Column(name = "expect_start_time")
	public Integer getExpectStartTime() {
		return expectStartTime;
	}

	public void setExpectStartTime(Integer expectStartTime) {
		this.expectStartTime = expectStartTime;
	}

	@Column(name = "expect_end_time")
	public Integer getExpectEndTime() {
		return expectEndTime;
	}

	public void setExpectEndTime(Integer expectEndTime) {
		this.expectEndTime = expectEndTime;
	}

	@Column(name = "reason")
	public String getReason() {
		return reason;
	}

	public void setReason(String reason) {
		this.reason = reason;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
	@JsonApiIncludeByDefault
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "type")
	public Dicttype getType() {
		return type;
	}

	public void setType(Dicttype type) {
		this.type = type;
	}

	@Column(name = "real_end_Time")
	public Integer getRealEndTime() {
		return realEndTime;
	}

	public void setRealEndTime(Integer realEndTime) {
		this.realEndTime = realEndTime;
	}

	@Transient
	public Set<Integer> getLeaveDay() {
		return leaveDay;
	}

	public void setLeaveDay(Set<Integer> leaveDay) {
		this.leaveDay = leaveDay;
	}

	@Transient
	public String getLeaveDayStr() {
		return leaveDayStr;
	}

	public void setLeaveDayStr(String leaveDayStr) {
		this.leaveDayStr = leaveDayStr;
	}

}
